﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WatiN.Core;

namespace AutoDownload
{
    public class LoginPage : Page
    {
        public String LoginUrl
        {
            get { return "http://tailieu.vn/tai-khoan1/dangnhap.html"; }
        }

        public TextField UserNameField
        {
            get { return Document.TextField(Find.ById("txtLoginUsername")); }
        }

        public TextField EmailField
        {
            get { return Document.TextField(Find.ById("txtLoginPassword")); }
        }

        public Button LoginButton
        {
            get { return Document.Button(Find.ByValue("Đăng nhập")); }
        }

        public bool LoginWith(string userName, string email)
        {
            UserNameField.TypeText(userName);
            EmailField.TypeText(email);
            LoginButton.Click();

            return (Document.Url.EndsWith("tailieu.vn/"));
        }
    }
}
